﻿//////////////////////////////////////////////////////////////////////////////
//This file is part of My Nes                                               //
//A Nintendo Entertainment System Emulator.                                 //
//                                                                          //
//Copyright © 2009 Ala Hadid (AHD)                                          //
//                                                                          //
//My Nes is free software; you can redistribute it and/or modify            //
//it under the terms of the GNU General Public License as published by      //
//the Free Software Foundation; either version 2 of the License, or         //
//(at your option) any later version.                                       //
//                                                                          //
//My Nes is distributed in the hope that it will be useful,                 //
//but WITHOUT ANY WARRANTY; without even the implied warranty of            //
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
//GNU General Public License for more details.                              //
//                                                                          //
//You should have received a copy of the GNU General Public License         //
//along with this program; if not, write to the Free Software               //
//Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA//
//////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace AHD.MyNes.Nes
{
    using System.Threading;
    using System.Windows;
    using System.Windows.Media.Animation;
    using System.Windows.Threading;

    

    public class HighResTimer
    {
        private ManualResetEvent wait = new ManualResetEvent(false);

        public double GetCurrentTime()
        {
            return TimeSpan.FromTicks(DateTime.Now.Ticks).TotalSeconds;
        }

        public void Wait(double seconds)
        {
            if (seconds > 0)
            {
                wait.WaitOne((int) (seconds*1000));
            }
        }
        //[DllImport("Kernel32.dll")]
        //private static extern bool QueryPerformanceCounter(out long lpPerformanceCount);
        //[DllImport("Kernel32.dll")]
        //private static extern bool QueryPerformanceFrequency(out long lpFrequency);
    }
}
